package org.ling.xuan.channel;

import cn.hutool.core.io.FileUtil;
import org.ling.xuan.context.AddPipeLineContext;
import org.ling.xuan.context.CheckChannelContext;
import org.ling.xuan.context.CheckPipelineContext;

public class FileNameAndPathCheckChannel extends CheckChannel<CheckChannelContext, AddPipeLineContext> {
    @Override
    public <T> CheckChannelContext getContext(AddPipeLineContext pipeContext) {
        return new CheckChannelContext();
    }

    @Override
    public <R extends CheckPipelineContext> boolean match(R pipeContext, CheckChannelContext channelContext) {
        return FileUtil.isFile(pipeContext.getFilePath());
    }
}
